package com.woniu.finance.contorller;


import com.woniu.aop.OperationLogAnnotation;
import com.woniu.finance.entity.Menu;
import com.woniu.finance.service.IMenuService;
import com.woniu.util.utils.HttpResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 菜单 前端控制器
 * </p>
 *
 * @author 刘品水
 * @since 2023-04-25
 */
@RestController
@RequestMapping("/finance/menu")
public class MenuController {
    @Autowired
    private IMenuService menuService;

    /**
     * @Description: 保存菜单表信息
     * @Param: [asset]
     * @return: com.woniu.util.utils.HttpResult<?>
     * @Author: 阿水
     * @Date: 2023/4/27
     */
    @PostMapping("saveMenu")
    @OperationLogAnnotation(operModul = "融资企业-保存菜单表信息",operType = "新增",operDesc = "保存菜单表信息")//操作日志注解
    public HttpResult<?> saveMenu(@RequestBody Menu menu) {
        return menuService.saveMenu(menu);
    }

    /**
     * @Description: 根据id删除菜单表
     * @Param: [id]
     * @return: com.woniu.util.utils.HttpResult<?>
     * @Author: 阿水
     * @Date: 2023/4/27
     */
    @RequestMapping("removeMenuById")
    @OperationLogAnnotation(operModul = "融资企业-根据id删除菜单表",operType = "删除",operDesc = "根据id删除菜单表")//操作日志注解
    public HttpResult<?> removeMenuById(Integer id) {
        return menuService.removeMenuById(id);
    }

    /**
     * @Description: 修改菜单表信息
     * @Param: [asset]
     * @return: com.woniu.util.utils.HttpResult<?>
     * @Author: 阿水
     * @Date: 2023/4/27
     */

    @RequestMapping("modifyMenu")
    @OperationLogAnnotation(operModul = "融资企业-修改菜单表信息",operType = "修改",operDesc = "修改菜单表信息")//操作日志注解
    public HttpResult<?> modifyMenu(@RequestBody Menu menu) {
        return menuService.modifyMenu(menu);
    }

    /**
     * @Description: 根据id查询菜单表
     * @Param: [id]
     * @return: com.woniu.util.utils.HttpResult<?>
     * @Author: 阿水
     * @Date: 2023/4/27
     */
    @RequestMapping("findMenuById")
    @OperationLogAnnotation(operModul = "融资企业-根据id查询菜单表",operType = "查询",operDesc = "根据id查询菜单表")//操作日志注解
    public HttpResult<?> findMenuById(Integer id) {
        return menuService.findMenuById(id);
    }

    /**
     * @Description: 查询所有菜单表
     * @Param: [id]
     * @return: com.woniu.util.utils.HttpResult<?>
     * @Author: 阿水
     * @Date: 2023/4/27
     */
    @RequestMapping("findAllMenu")
    @OperationLogAnnotation(operModul = "融资企业-查询所有菜单表",operType = "查询",operDesc = "查询所有菜单表")//操作日志注解
    public HttpResult<?> findAllMenu() {
        return menuService.findAllMenu();
    }

    /**
    * @Description: 根据用户账号 查询用户菜单表
    * @Param: []
    * @return: com.woniu.util.utils.HttpResult<?>
    * @Author: 阿水
    * @Date: 2023/5/6
    */

    @RequestMapping("queryFinanceMenusByUserName")
    @OperationLogAnnotation(operModul = "融资企业-查询用户菜单表",operType = "查询",operDesc = "查询用户菜单表")//操作日志注解
    public HttpResult<?> queryFinanceMenusByUserName(String userName) {
        return menuService.queryFinanceMenusByUserName(userName);
    }



}
